/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package severdorhttpsimples;

/**
 *
 * @author Alisson
 */
import java.io.*;
import java.net.*;

class ServidorTCP {

  public static void main(String argv[]) throws Exception
    {
      String fraseCliente;
      String fraseEmMaiusculas;

      ServerSocket socketRecepcao = new ServerSocket(6789);

      while(true) {

            Socket socketConexao = socketRecepcao.accept();

           BufferedReader doCliente =
              new BufferedReader(new
              InputStreamReader(socketConexao.getInputStream()));

           DataOutputStream  paraCliente =
             new DataOutputStream(socketConexao.getOutputStream());

           fraseCliente= doCliente.readLine();

           fraseEmMaiusculas= fraseCliente.toUpperCase() + '\n';

           paraCliente.writeBytes(fraseEmMaiusculas);
        }
    }
}
